{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d544826c",
   "metadata": {},
   "source": [
    "# 基础题目\n",
    "\n",
    "## 题目列表\n",
    "**题目来源**：[python语言中的运算符](https://github.com/jackfrued/Python-100-Days/blob/master/Day01-20/04.Python%E8%AF%AD%E8%A8%80%E4%B8%AD%E7%9A%84%E8%BF%90%E7%AE%97%E7%AC%A6.md)\n",
    "\n",
    "- 例子1：华氏温度转摄氏温度\n",
    "- 例子2：计算圆的周长和面积\n",
    "- 例子3：判断闰年\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e9ddcf87",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "89.0华氏度 = 31.7摄氏度\n",
      "89.0华氏度 = 31.7摄氏度\n"
     ]
    }
   ],
   "source": [
    "# 例子1：华氏温度转摄氏温度\n",
    "'''\n",
    "C=(F-32)/1.8\n",
    "'''\n",
    "f = float(input())\n",
    "c = (f - 32)/1.8\n",
    "print('%.1f华氏度 = %.1f摄氏度' % (f,c))\n",
    "print(f'{f:.1f}华氏度 = {c:.1f}摄氏度')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "224d7df5",
   "metadata": {},
   "source": [
    "**格式化输入输出**：\n",
    "……\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "81c2e701",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "圆的周长:33.54\n",
      "圆的面积:89.54\n"
     ]
    }
   ],
   "source": [
    "# 例子2：计算圆的周长和面积\n",
    "radius = float(input(\"请输出圆的半径\"))\n",
    "perimeter = 2*3.14*radius\n",
    "area = 3.14*radius**2\n",
    "\n",
    "print(f\"圆的周长:{perimeter:.2f}\")\n",
    "print(f\"圆的面积:{area:.2f}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "379e396f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入的年份是否为闰年:True\n"
     ]
    }
   ],
   "source": [
    "# 例子3：判断闰年\n",
    "## 按照我们目前使用的公历来进行判断\n",
    "year = int(input(\"请输入一个公历年份：\"))\n",
    "is_year = (year % 4 == 0 and year % 100 != 0 or year % 400 == 0)\n",
    "print(f\"输入的年份是否为闰年:{is_year}\")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "env_py38",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
